﻿using System.Reflection;

namespace Borg
{
    internal abstract class Task<T> : ITask
        where T : RepositoryElement
    {
        internal uint taskGroupId;
        internal Assembly initiator;

        internal T obj;

        public abstract string Name { get; }

        public uint TaskGroupId
        {
            get { return taskGroupId; }
        }

        public Assembly Initiator
        {
            get { return initiator; }
        }

        public Assembly Target
        {
            get { return obj.Assembly; }
        }

        public object TargetRepositoryElement
        {
            get { return obj; }
        }

        public Assembly InitiatorAssembly
        {
            get { return initiator; }
            set { initiator = value; }
        }

        protected Task(T obj, uint taskGroupId, Assembly initiator)
        {
            this.obj = obj;
            this.taskGroupId = taskGroupId;
            this.initiator = initiator;
        }

        public abstract void Execute();

        public abstract override string ToString();
    }
}

